package com.example.springboot.config.logFilter;

import javax.servlet.*;
import java.io.IOException;

/**
 * 定义日志过滤器
 *
 * @Author:ChenZhangKun
 * @Date: 2021/4/28 16:20
 */
public class LogFilter implements Filter {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("记录请求前日志信息");
        // 放行
        filterChain.doFilter(servletRequest, servletResponse);
        System.out.println("记录响应的日志信息");
    }
}
